package cn.pli.bike.ui;

import android.view.View;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.framemodule.base.BaseDelegate;

import cn.pli.bike.R;

/**
 * Created by shangdongzhou on 2017/11/8.
 */

public class MainDelegate extends BaseDelegate {
    private TextView tvUserState, tvUserAction;
    private RelativeLayout rlUserType;


    private RelativeLayout rlRiding, rlRideEnd;          //骑行中，骑行结束
    private TextView tvRidingTime, tvStartTime, tvRidingBikeNumber;
    private TextView tvSpand, tvOverTime, tvBikeNumber;


    @Override

    public void initTitleBar() {

    }

    @Override
    public int getRootLayoutId() {
        return R.layout.activity_main;
    }

    @Override
    public void initWidget() {
        super.initWidget();
        tvUserState = get(R.id.tv_main_user_state_info);
        tvUserAction = get(R.id.tv_main_user_state_action);
        rlUserType = get(R.id.rl_main_charge_deposit);


        rlRiding = get(R.id.rl_riding_state);
        rlRideEnd = get(R.id.rl_ride_over);
        rlRiding.setVisibility(View.GONE);
        rlRideEnd.setVisibility(View.GONE);

        tvRidingTime = get(R.id.tv_riding_time);
        tvStartTime = get(R.id.tv_open_lock_time);
        tvRidingBikeNumber = get(R.id.tv_riding_bike_number);
        tvSpand = get(R.id.tv_ride_expends);
        tvOverTime = get(R.id.tv_ride_over_time);
        tvBikeNumber = get(R.id.tv_bike_number);


    }

    public void setUserState(int type) {
        switch (type) {
            case MainActivity.USER_LOGON:
                rlUserType.setVisibility(View.VISIBLE);
                tvUserState.setText(R.string.user_main_logout);
                tvUserAction.setText(R.string.logon);
                break;            //用户没有登录
            case MainActivity.USER_NO_DEPOSIT:
                rlUserType.setVisibility(View.VISIBLE);
                tvUserState.setText(R.string.user_no_deposit);
                tvUserAction.setText(R.string.charge_deposit);
                break;        //用户没有交押金
            case MainActivity.USER_CAN_RIDE:
                rlUserType.setVisibility(View.GONE);
                break;          //用户正常
            case MainActivity.USER_NO_REAL_NAME_AUTH:           //没有实名认证
                rlUserType.setVisibility(View.VISIBLE);
                tvUserState.setText(R.string.user_no_realname_auth);
                tvUserAction.setText(R.string.realname_auth);

        }
    }

    public RelativeLayout getRlRiding() {
        return rlRiding;
    }


    public RelativeLayout getRlRideEnd() {
        return rlRideEnd;
    }


    public TextView getTvUserState() {
        return tvUserState;
    }

    public TextView getTvUserAction() {
        return tvUserAction;
    }

    public RelativeLayout getRlUserType() {
        return rlUserType;
    }

    public TextView getTvRidingTime() {
        return tvRidingTime;
    }

    public TextView getTvStartTime() {
        return tvStartTime;
    }

    public TextView getTvRidingBikeNumber() {
        return tvRidingBikeNumber;
    }

    public TextView getTvSpand() {
        return tvSpand;
    }

    public TextView getTvOverTime() {
        return tvOverTime;
    }

    public TextView getTvBikeNumber() {
        return tvBikeNumber;
    }
}
